package com.itheima.app.manager;

import com.itheima.app.interceptor.UserHolder;
import com.itheima.feign.DbServiceFeign;
import com.itheima.vo.AnswersVo;
import com.itheima.vo.ReportVo;
import com.itheima.vo.TopicVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestSoulManager {

    @Autowired
    private DbServiceFeign dbServiceFeign;

    //查询问卷
    public List<TopicVo> queryTestSoul() {
        Long userId = UserHolder.get().getId();
        return dbServiceFeign.queryTestSoul(userId);
    }

    //提交问卷
    public Long saveTestSoul(AnswersVo answersVo) {
        Long userId = UserHolder.get().getId();
        return dbServiceFeign.saveTestSoul(answersVo, userId);
    }

    //查询报告
    public ReportVo queryReport(Long id) {
        Long userId = UserHolder.get().getId();
        return dbServiceFeign.queryReport(id, userId);
    }
}
